﻿
<section class="content-header">
    <h1>
        专题管理
    </h1>
    <ol class="breadcrumb">
        <li><a href="@Url.Action("Index", "Home")"><i class="fa fa-home"></i> 首页</a></li>
        <li class="active">专题</li>
    </ol>
</section>

<section class="content">
    <div class="row">
        <div class="col-lg-12">
            <div class="box box-primary">
                <div class="box-header with-border">

                    <div class="dataTable-tools btn-group">
                        @Html.Bootstrap().LinkButton("添加", ToolBarIco.Create).Href("javascript:window.app.loadUI('" + Url.Action("Create") + "')").Route(Url.Action("Create"))
                        @Html.Bootstrap().LinkButton("删除", ToolBarIco.Delete).Click("window.app.deleteItem('dataList','" + @Url.Action("Delete") + "')").Route(Url.Action("Delete"))
                        @Html.Bootstrap().LinkButton("刷新", ToolBarIco.Refresh).Click("window.app.search();")
                    </div>
                    <div class="box-tools SearchArea">
                        <div class="input-group input-group-sm" style="width:150px;float:right;">
                            <input type="text" name="Name" class="form-control pull-right" placeholder="名称">

                            <div class="input-group-btn">
                                <button type="button" class="btn btn-default" onclick="window.app.search();"><i class="fa fa-search"></i></button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="box-body no-padding">

                    <div class="table-responsive">
                        <table id="dataList" class="table table-bordered table-striped table-hover dataTable text-center" width="100%"></table>
                    </div>

                </div>
            </div>


        </div>
    </div>
</section>

<script type="text/javascript">
    $(document).ready(function () {

        $('#dataList').dataTable({
            "serverSide": true,
            "ajax": {
                "url": "@Url.Action("GetPaged")",
                "type": "POST"
            },
            "columnDefs": [
                { sDefaultContent: '', aTargets: ['_all'] },
                { "searchable": false, sortable: false, "orderable": false, "targets": [-1, 0, 1, 2] },
                { "sClass": "editableCol", "aTargets": [1] }
            ],
            columns: [
                { title: '<label class="checkbox i-checks"><input type="checkbox" /><i></i></label>', data: function (row, type, set) { return '<label class="checkbox i-checks"><input type="checkbox" name="cellCheckbox" value="' + row.id + '" /><i></i></label>'; }, "bStorable": false, width: 30 },

                {
                    title: "名称", data: function (row) {
                        return '<a href="javascript:window.app.loadUI(\'@Url.Action("Edit")/' + row.id + '\')">' + row.title + '</a>';
                    }, width: 200
                },

                {
                    title: "描述", data: "content"
                },
                {
                    title: "审核状态", data:  function(row) {
                        return row.isChecked ? "<span class=\"label label-success\">已审核</span>" : "<span class=\"label label-danger\">未审核</span>";
                        
                    }, width: 60
                },
                {
                    title: "操作", orderable: false, width: 60, "sClass": "center",
                    "data": function (row) {
                        return "<input class='btn btn-primary btn-sm' onclick=\"window.app.loadUI('@Url.Action("Review")/" + row.id + "');\" value='审核' type='button'>";
                    }
                }
            ]
        });
    });


</script>